<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
String path = request.getContextPath();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ include file="/pages/login/common.jsp" %>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta content="B2B电商平台" name="description"/>
<meta content="B2B电商平台" name="keyword"/>

<title>B2B电商平台.零售认证</title>
<%@ include file="/pages/mainPage/header.jsp" %>
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/btn.css" />
<style type="text/css">
body{}
table{border-collapse: collapse;}
tr{ 
    display:block; /*将tr设置为块体元素*/ 
    margin:10px;  /*设置tr间距为2px*/ 
    width:100%;
}
td{padding:2px;height:30px; line-height:30px;}
.td1{
	width:20%;
	min-width:240px;
	font-size:14px;
	text-align:right;
	vertical-align: middle;
}
.input1{
	width:300px;
	height:30px;
	line-height:30px;
	vertical-align:middle;
	float:left;
}
#btnDiv a{
   color:black;
}
#btnDiv a:hover{
   color:white;
}
button{
    width:44px;
    height:24px;
    line-height:24px;   
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: 0 -203px;
    border:0;
    cursor:pointer;
    font: 12px/1.5 arial,tahoma,\5b8b\4f53;
    margin: 0 0 0 5px;
    outline:none;
    background-image: url('<%=path%>/include/css/img/xs_bgx.png');   
}
.promptBox{display:inline-block;height:30px;padding-left:5px;width:200px;white-space:nowrap; z-index:50; position:relative;}
.tips-errow{background-position:-296px -22px;color:#f52c2c;}
.tips-ok{background-position:-296px 14px;color:#666;}
.tipsCur{background-position:-296px -55px;color:#666;}
.approveDiv{width:100%;height:23px;margin:0 20px;;padding:15px 0 10px 0;border-bottom: 1px solid #ADADAD;color:blue;}
.select1{
	width: 196px;
    height: 30px;
}
.select2{
    height: 30px;
}
</style>
<script type="text/javascript">
	
</script>
</head>
<body style="font-family: '微软雅黑'">
	<div id="contentDiv" style="padding:5px; width:99%;">
		<div style="width:100%;height:30px;border-bottom:1px solid #ADADAD;">
			<div class="toptil">零售认证信息</div>
		</div>
		<form id="fm" name="fm" class="form-horizontal form-validate" method="post" action="" novalidate="novalidate">
			<input type="hidden" id="shopId" name="shopId" value="${userInfo.shopId }">
			<div style="width:100%;margin-top:20px;margin-left:10px;">
				<table style="width:100%;">
					<c:if test="${licenceNo eq '' }">
						<tr>
							<td class="td1" nowrap>烟草许可证号/非烟零售账号：</td>
							<td class="rightTd" nowrap>
								<input id='licenceNo' name='licenceNo' value=''/>
							</td>
						</tr>
						<tr>
							<td class="td1" nowrap>烟草用户简码/非烟零售账号密码：</td>
							<td class="rightTd" nowrap>
								<input id='facilityNum' name='facilityNum' value=''/>
							</td>
						</tr>
						<tr>
							<td class="td1">&nbsp;</td>
							<td style="">
								<div id="btnDiv">
									<a onclick="_storeBindSave();" class="btn btn-primary" style="text-decoration:none;color: #fff">认证</a>
								</div>
							</td>
						</tr>
					</c:if>
					<c:if test="${licenceNo ne '' }">
						<tr>
							<td class="td1" nowrap>烟草许可证号/非烟零售账号：</td>
							<td class="rightTd" nowrap>
								${bindInfo.LICENCE_NO }
							</td>
						</tr>
						<c:if test="${bindInfo.USER_TYPE eq 'LICENCE' }">
						<tr>
							<td class="td1" nowrap>烟草用户简码：</td>
							<td class="rightTd" nowrap>
								${bindInfo.FACILITY_NUM }
							</td>
						</tr>
						</c:if>
						<tr>
							<td class="td1" nowrap>店铺名称：</td>
							<td class="rightTd" nowrap>
								${bindInfo.USER_NAME }
							</td>
						</tr>
						<tr>
							<td class="td1" nowrap>联系电话：</td>
							<td class="rightTd" nowrap>
								${bindInfo.USER_TEL }
							</td>
						</tr>
						<c:if test="${bindInfo.USER_TYPE eq 'LICENCE' }">
						<tr>
							<td class="td1" nowrap>店铺地址：</td>
							<td class="rightTd" nowrap>
								${bindInfo.USER_ADDRESS }
							</td>
						</tr>
						</c:if>
					</c:if>
					
				</table>
			</div>
		</form>
	</div>
</body>
<script type="text/javascript">
	function _storeBindSave(){
		var shopId = $('#shopId').val();
		var licenceNo = $('#licenceNo');
		var facilityNum = $('#facilityNum');
		if(licenceNo == null || $.trim(licenceNo.val()) == ''){
            parent.layer.open({skin: 'msg', content: '烟草许可证号/非烟零售账号不能为空'});
            return false;
       	} 
		if(facilityNum == null || $.trim(facilityNum.val()) == ''){
            parent.layer.open({skin: 'msg', content: '烟草用户简码/非烟零售账号密码不能为空'});
            return false;
       	} 
       	parent.layer.load(1, {shade: [0.1,'#fff'] });
		$.ajax({
			type:"post",
			url: "<%=path%>/storeBind/storeBindSave.do",
			data:{
				shopId : shopId,
				licenceNo : licenceNo.val(),
				facilityNum : facilityNum.val()
			},
			dataType:"json",
			success:function(data){
				parent.layer.closeAll();
				if(data.success){
					parent.layer.open({skin: 'msg',  content: data.msg});
					window.location.href='<%=path%>/storeBind/toStoreBindInfoPage.do';
				} else {
					parent.layer.open({skin: 'msg',  content: data.msg});
				}
			}
		});
	}
</script>
</html>
